package com.futureCloudMOM.controller.core.web.basic;

import com.futureCloudMOM.common.annotation.Anonymous;
import com.futureCloudMOM.common.annotation.Log;
import com.futureCloudMOM.common.core.page.TableDataInfo;
import com.futureCloudMOM.common.utils.core.QueryWapperDTO;
import com.futureCloudMOM.controller.core.controller.BaseApiController;
import com.futureCloudMOM.core.domain.BasicMaterialType;
import com.futureCloudMOM.core.service.BasicMaterialTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * 文件名 BasicMaterialTypeController
 *
 * @since 2023/6/6 14:37
 */
@Api(tags = "物料类别")
@RestController
@RequestMapping("basic/material_type")
public class BasicMaterialTypeController extends BaseApiController<BasicMaterialType, BasicMaterialType, BasicMaterialTypeService> {

    public BasicMaterialTypeController(BasicMaterialTypeService service) {
        super(service);
    }

    @Autowired
    private BasicMaterialTypeService basicMaterialTypeService;

    @Log(title = "物料类别--树形结构--列表页")
    @ApiOperation(value = "物料类别--树形结构--列表页")
    @PostMapping("getListByTree")
    public TableDataInfo getListByTree(@RequestBody(required = false) List<QueryWapperDTO> list,BasicMaterialType basicMaterialType){
        startPage();
        return getDataTable(basicMaterialTypeService.getListByTree(list,basicMaterialType));
    }

    @Log(title = "物料类别数据获取(树形结构)")
    @ApiOperation("物料类别数据获取(树形结构)")
    @PostMapping("/getMaterialTypeList")
    public TableDataInfo getMaterialTypeList(@RequestBody BasicMaterialType materialType){
        return getDataTable(service.getMaterialTypeList(materialType));
    }




}
